package com.test.demo;

import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class DemoController {

	@Autowired
	public MybatisTest MabatisTest;
	@Autowired
	public Logtest logTest;

	
	 @RequestMapping("/tttt")
	 public String index(Model map) {
		 map.addAttribute("username","kktest");
	     map.addAttribute("host", "http://www.qq.com");
	     return "index";
	 }
	
	 @RequestMapping("/find")
	 @ResponseBody
	 public User find() {
		 return MabatisTest.findByName();
	 }
	 
	 @RequestMapping("/inserts")
	 void insertinto() {
		 MabatisTest.insert();
	 }
	 
	 @RequestMapping("/findall")
	 @ResponseBody
	 List<User> findAll(){
		 return MabatisTest.findAll();
	 }
	 
	 @RequestMapping("/getlog")
	 void getlog() {
		 logTest.testlog();
	 }
	 

	 
}
